home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / private / _sgetnl.c < prev    next >
C/C++ Source or Header  |  1993-06-18  |  2KB  |  86 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #if    BUG68K
  5. #ifdef PDCDEBUG
  6. char *rcsid__sgetnl = "$Header: C:\CURSES\private\RCS\_sgetnl.c 2.1 1993/06/18 20:23:50 MH Rel MH $";
  7. #endif
  8.  
  9. void c_setnl( char* );        /* conv nl -> CTRL-\ */
  10. void c_getnl( char* );        /* conv CTRL-\ -> nl */
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_setnl()    - BUG68K: set newline for 68000 C compiler
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses function.
  17.  
  18.      This function circumvents a problem in the 68000 C library: If
  19.      the standard sprintf is used, it will ignore any newlines in
  20.      the format string. Therefore this routine changes the newlines
  21.      to CTRL-\ characters, to be restored later by the getnl()
  22.      function.
  23.  
  24.   PDCurses Return Value:
  25.      This function does not return a value.
  26.  
  27.   PDCurses Errors:
  28.      There are no defined errors for this routine.
  29.  
  30.   Portability:
  31.      PDCurses    void    PDC_setnl( char* fmt );  /* BUG68K only */
  32.  
  33. **man-end**********************************************************************/
  34.  
  35. void    PDC_setnl(char *fmt)
  36. {
  37. #ifdef PDCDEBUG
  38.     if (trace_on) PDC_debug("PDC_setnl() - called\n");
  39. #endif
  40.  
  41.     while (*fmt)
  42.     {
  43.         if (*fmt == '\n')
  44.             *fmt = 0x1c;
  45.         fmt++;
  46.     }
  47. }
  48.  
  49.  
  50.  
  51. /*----------------------------------------------------------------------
  52. $ PDC_getnl()    - BUG68K: get newline for 68000 C compiler
  53. $
  54. $ PDCurses Description:
  55. $    This is a private PDCurses function.
  56. $
  57. $    This function circumvents a problem in the 68000 C library: If
  58. $    the standard sprintf is used, it will ignore any newlines in
  59. $    the format string. Therefore this routine changes CTRL-\
  60. $    characters (already set by setnl()) back to newlines.
  61. $
  62. $ PDCurses Return Value:
  63. $    This function does not return a value.
  64. $
  65. $ PDCurses Errors:
  66. $    There are no defined errors for this routine.
  67. $
  68. $ Portability:
  69. $    PDCurses    void    PDC_getnl( char* fmt );  /* BUG68K only */
  70. $
  71. $----------------------------------------------------------------------
  72. */
  73. void    PDC_getnl(cahr *fmt)
  74. {
  75. #ifdef PDCDEBUG
  76.     if (trace_on) PDC_debug("PDC_getnl() - called\n");
  77. #endif
  78.  
  79.     while (*fmt)
  80.     {
  81.         if (*fmt == 0x1c)
  82.             *fmt = '\n';
  83.     }
  84. }
  85. #endif
  86.